#pragma once
#include "Hittable.h"
#include "Material.h"
#include "Texture.h"

class CConstantMedium : public CHittable {
public:
	CConstantMedium(shared_ptr<CHittable> vBoundary, double vDensity, shared_ptr<CTexture> vTex)
		:m_Boundary(vBoundary), m_NegInvDensity(-1/vDensity),m_PhaseFunction(make_shared<CIsotropic>(vTex)){}
	CConstantMedium(shared_ptr<CHittable> vBoundary, double vDensity, const Color& vAlbedo)
		:m_Boundary(vBoundary), m_NegInvDensity(-1 / vDensity), m_PhaseFunction(make_shared<CIsotropic>(vAlbedo)) {}

	bool hit(const CRay& vR, CInterval vRayT, CHitRecord& vHitRecord)const override;

	CAABB boundingBox()const override { return m_Boundary->boundingBox(); }

private:
	shared_ptr<CHittable>m_Boundary;
	double m_NegInvDensity;
	shared_ptr<CMaterial>m_PhaseFunction;
};